/*
 * Copyright (C) 2011 Dirk Weißenborn, dirk.weissenborn@gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.weissenborn.colabtex.server.user;

import java.util.ArrayList;
import java.util.List;

import com.weissenborn.colabtex.server.user.Permission;

/**
 * The persistence Class ColabTexUser.
 */
public class ColabTexUser {

	/** The name. */
	private String name;
	
	/** The permissions. */
	private List<Permission> permissions;
	
	/** The password. */
	private String password;
	
	/** The last login. */
	private Long lastLogin;

	/**
	 * Instantiates a new colab tex user.
	 */
	public ColabTexUser() {
		permissions = new ArrayList<Permission>();
		setLastLogin(null);
	}
	
	/**
	 * Instantiates a new colab tex user.
	 *
	 * @param name the name
	 * @param password the password
	 */
	public ColabTexUser(String name, String password) {
		this.name = name;
		this.password = password;
		permissions = new ArrayList<Permission>();
		setLastLogin(null);
	}
	
	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * Gets the permissions.
	 *
	 * @return the permissions
	 */
	public List<Permission> getPermissions() {
		if(permissions == null)
			permissions = new ArrayList<Permission>();
		return permissions;
	}
	
	/**
	 * Sets the permissions.
	 *
	 * @param permissions the new permissions
	 */
	public void setPermissions(List<Permission> permissions) {
		this.permissions = permissions;
	}
	
	/**
	 * Gets the password.
	 *
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}
	
	/**
	 * Sets the password.
	 *
	 * @param password the new password
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * Gets the last login.
	 *
	 * @return the last login
	 */
	public Long getLastLogin() {
		return lastLogin;
	}

	/**
	 * Sets the last login.
	 *
	 * @param lastLogin the new last login
	 */
	public void setLastLogin(Long lastLogin) {
		this.lastLogin = lastLogin;
	}

		
}
